package eache

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
	"shop-ease/appconfig"
)

var Rdb *redis.Client

var Ctx = context.Background()

func Init() {
	redisConfig := appconfig.Config.Redis
	Addr := fmt.Sprintf("%s:%d", redisConfig.Host, redisConfig.Port)
	Rdb = redis.NewClient(&redis.Options{
		Addr:     Addr,
		Password: redisConfig.Password, // no password set
		DB:       redisConfig.Database, // use default DB
	})

}
